package com.sky.controller.user;

import com.sky.entity.Category;
import com.sky.result.Result;
import com.sky.service.CategoryService;
import com.sky.vo.DishItemVO;
import com.sky.vo.DishVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequiredArgsConstructor
@Slf4j
@RestController
@RequestMapping("/user")
public class CategoryController {
    private final CategoryService categoryService;
    @GetMapping("/category/list")
    public Result<List<Category>> selectCategory(Integer type) {
        List<Category> categoryList = categoryService.selectCategory(type);
        return Result.success(categoryList);
    }

    @GetMapping("/dish/list")
    public Result<List<DishVO>> selectDishByCategoryId(String categoryId) {
        List<DishVO> dishVOList = categoryService.selectDishByCategoryId(categoryId);
        return Result.success(dishVOList);
    }
}
